package com.becca.cake.model.goods;

import java.io.Serializable;
import java.util.Date;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.util.StringUtil;

/**
 * 商品价格规格对用表
 * @copyright  尊星(上海)信息科技有限公司
 * @author hejinguo
 * @date 2016年4月10日 上午2:35:25
 */
public class GoodsPriceSizeModel implements Serializable {
    /**  */
    private static final long  serialVersionUID      = -3221791596396192614L;
    /**商品属性不能为空*/
    public static final String GOODS_PRICE_ID_NULL   = "商品属性不能为空";

    /**商品属性不能为空*/
    public static final String GOODS_PRICE_NO_EXISTS = "商品属性信息不存在";

    private Integer            id;
    /**商品ID*/
    private Integer            goodsId;
    /**商品编码*/
    private String             goodsCode;
    
    /**商品价格*/
    private Double             goodsPrice;
    /**商品规格编码*/
    private String             goodsStandardCode;
    /**商品尺寸*/
    private String             goodsSize;
    /**商品重量*/
    private String             goodsWeight;
    /**商品单位*/
    private String             goodsUnits;
    /**排序*/
    private Integer            goodsOrder;
    /**是否删除(0:不删除  1:删除)*/
    private Byte               isDelete;
    /**创建时间*/
    private Date               createdDate;
    /**创建人*/
    private String             createdName;
    /**修改时间*/
    private Date               updatedDate;
    /**修改人*/
    private String             updatedName;
    
    /**商品类型(0:商品 1:配件)*/
    private Byte               goodsType;
    
    /**商品展示图*/
    private String             goodsPic;
    
    /**赠送餐具数量*/
    private Integer            giveLaidNumber;
    /**适合人数*/
    private String   		   goodsEatNumber;
    
    /**商品类型(0:商品 )*/
    public static final Byte    GOODS_TYPE_DEFALUT = 0;
    
    /**商品类型(1:配件 )*/
    public static final Byte    GOODS_TYPE_PARTS  = 1;
    
    /**是否删除(0:不删除 )*/
    public static final Byte    IS_NOT_DELETE = 0;
    /**是否删除(1:删除 )*/
    public static final Byte    IS_DELETE = 1;
    
    /**该商品尺寸已存在*/
    public static final String  GOODSPRICE_IS_EXIST = "该商品尺寸已存在";
    
    /**该商品尺寸已被删除*/
    public static final String  GOODSPRICE_IS_NOT_EXIST = "该商品尺寸已被删除";
    
    /**添加或修改商品对象不能为空*/
    public static final String GOODS_PRICE_SIZE_NULL = "添加或修改商品对象不能为空";
    
    /**商品单价不能为空*/
    public static final String GOODS_PRICE_NULL = "商品单价不能为空";
    
    /**商品重量不能为空*/
    public static final String GOODS_WEIGHT_NULL = "商品重量不能为空";
    
    /**商品尺寸不能为空*/
    public static final String GOODS_SIZE_NULL = "商品尺寸不能为空";
    
    /**商品单位不能为空*/
    public static final String GOODS_UNITS_NULL = "商品单位不能为空";
    
    /**商品赠送餐具数量不能为空*/
    public static final String GIVE_LAID_NUMBER_NULL = "商品赠送餐具数量不能为空";
    
    /**排序不能为空*/
    public static final String GOODS_ORDER_NULL = "排序不能为空";
    
    /**商品尺寸ID不能为空*/
    public static final String GOODS_PRICE_SIZE_ID_NULL = "商品尺寸ID不能为空";
    
    /**
     * 校验商品尺寸
     * @param goodsPriceSizeModel
     */
    public static void validSaveGoodsPriceSize(GoodsPriceSizeModel goodsPriceSizeModel){
        if(goodsPriceSizeModel == null){
            throw new ServiceException(GoodsPriceSizeModel.GOODS_PRICE_SIZE_NULL);
        }
        if(goodsPriceSizeModel.getGoodsPrice() == null){
            throw new ServiceException(GoodsPriceSizeModel.GOODS_PRICE_NULL);
        }
        if(StringUtil.isEmpty(goodsPriceSizeModel.getGoodsWeight())){
            throw new ServiceException(GoodsPriceSizeModel.GOODS_WEIGHT_NULL);
        }
        if(StringUtil.isEmpty(goodsPriceSizeModel.getGoodsSize())){
            throw new ServiceException(GoodsPriceSizeModel.GOODS_SIZE_NULL);
        }
        if(StringUtil.isEmpty(goodsPriceSizeModel.getGoodsUnits())){
            throw new ServiceException(GoodsPriceSizeModel.GOODS_UNITS_NULL);
        }
        if(goodsPriceSizeModel.getGiveLaidNumber() == null){
            throw new ServiceException(GoodsPriceSizeModel.GIVE_LAID_NUMBER_NULL);
        }
        if(goodsPriceSizeModel.getGoodsOrder() == null){
            throw new ServiceException(GoodsPriceSizeModel.GOODS_ORDER_NULL);
        }
        
    }
    
    /**
     * 校验商品尺寸id是否为空
     * @param id
     */
    public static void validGoodsPriceSizeId(Integer id){
        if(id == null){
            throw new ServiceException(GoodsPriceSizeModel.GOODS_PRICE_SIZE_ID_NULL);
        }
    }
    
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }
    
    public String getGoodsCode() {
        return goodsCode;
    }

    public void setGoodsCode(String goodsCode) {
        this.goodsCode = goodsCode;
    }

    public String getGoodsStandardCode() {
        return goodsStandardCode;
    }

    public void setGoodsStandardCode(String goodsStandardCode) {
        this.goodsStandardCode = goodsStandardCode;
    }

    public String getGoodsPic() {
        return goodsPic;
    }

    public void setGoodsPic(String goodsPic) {
        this.goodsPic = goodsPic;
    }

    public Double getGoodsPrice() {
        return goodsPrice;
    }

    public void setGoodsPrice(Double goodsPrice) {
        this.goodsPrice = goodsPrice;
    }

    public String getGoodsSize() {
        return goodsSize;
    }

    public void setGoodsSize(String goodsSize) {
        this.goodsSize = goodsSize;
    }

    public String getGoodsWeight() {
        return goodsWeight;
    }

    public void setGoodsWeight(String goodsWeight) {
        this.goodsWeight = goodsWeight;
    }

    public String getGoodsUnits() {
        return goodsUnits;
    }

    public void setGoodsUnits(String goodsUnits) {
        this.goodsUnits = goodsUnits;
    }

    public Integer getGoodsOrder() {
        return goodsOrder;
    }

    public void setGoodsOrder(Integer goodsOrder) {
        this.goodsOrder = goodsOrder;
    }

    public Byte getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Byte isDelete) {
        this.isDelete = isDelete;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getCreatedName() {
        return createdName;
    }

    public void setCreatedName(String createdName) {
        this.createdName = createdName;
    }

    public Date getUpdatedDate() {
        return updatedDate;
    }

    public void setUpdatedDate(Date updatedDate) {
        this.updatedDate = updatedDate;
    }

    public String getUpdatedName() {
        return updatedName;
    }

    public void setUpdatedName(String updatedName) {
        this.updatedName = updatedName;
    }

    public Byte getGoodsType() {
        return goodsType;
    }

    public void setGoodsType(Byte goodsType) {
        this.goodsType = goodsType;
    }

    public Integer getGiveLaidNumber() {
        return giveLaidNumber;
    }

    public void setGiveLaidNumber(Integer giveLaidNumber) {
        this.giveLaidNumber = giveLaidNumber;
    }

    public String getGoodsEatNumber()
	{
		return goodsEatNumber;
	}

	public void setGoodsEatNumber(String goodsEatNumber)
	{
		this.goodsEatNumber = goodsEatNumber;
	}

	@Override
    public String toString() {
        return "goodsPriceSizeDO [id=" + id + ", goodsId=" + goodsId + ", goodsPrice=" + goodsPrice
               + ", goodsSize=" + goodsSize + ", goodsWeight=" + goodsWeight + ", goodsOrder="
               + goodsOrder + ", isDelete=" + isDelete + ", createdDate=" + createdDate
               + ", createdName=" + createdName + ", updatedDate=" + updatedDate + ", updatedName="
               + updatedName + "]";
    }

}
